<template>
  <!-- 面包屑 -->
  <el-breadcrumb :separator-icon="ArrowRight">
    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item>订单管理</el-breadcrumb-item>
    <el-breadcrumb-item>订单列表</el-breadcrumb-item>
  </el-breadcrumb>
  <!-- 卡片 -->
  <el-card>
    <div class="mt-4">
      <el-form label-width="auto">
        <el-input v-model="input3" style="max-width: 450px" placeholder="请输入内容" class="input-with-select">
          <template #append>
            <el-button :icon="Search" type="primary"/>
          </template>
        </el-input>
      </el-form>
    </div>

    <el-table :data="ordersdata" border style="width: 100%" class="ding">
      <el-table-column type="index" label="序号" width="60" />
      <el-table-column prop="order_number" label="订单编号" />
      <el-table-column prop="order_price" label="订单价格" />
      <el-table-column prop="pay_status" label="是否付款" />
      <el-table-column prop="is_send" label="是否发货" />
      <el-table-column prop="create_time" label="下单时间" />
      <el-table-column label="操作" />
    </el-table>
  </el-card>
</template>

<script setup lang="ts">
import request from "@/util/request"
import { responseUserData } from '@/api/user/type'
import { ArrowRight } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { onMounted, ref } from 'vue'
import { Search } from '@element-plus/icons-vue'
const input3 = ref('')

const total = ref(0)
const wang = ref({
  query: '',
  pagenum: 1,
  pagesize: 20
})
let ordersdata = ref([])
const dingdan = async () => {
  const { data, meta }: responseUserData = await request({
    url: `orders`,
    method: 'GET',
    params: wang.value,
  })
  if (meta.status !== 200) {
    return ElMessage.error('网络异常,稍后重试')
  }
  ordersdata.value = data.goods
  ElMessage.success(meta.msg)
}


onMounted(() => {
  dingdan()
}
)

</script>

<style scoped>
.el-card {
  margin-top: 20px;
}

.input-with-select .el-input-group__prepend {
  background-color: var(--el-fill-color-blank);
}

.ding {
  margin-top: 20px;
}
</style>
